﻿@using ECG.Utility
@{
    ViewBag.Title = "Những thương hiệu nổi bật | " + ViewBag.CateName;
    Layout = "~/Views/Shared/_LayoutHideCate.cshtml";
}

<!--PROVIDER-->
@*<div class="bb_cate_home">
    <div class="bb_cate_home_content">
        <div class="bb_cate_left">
            <div class="bb_cateListSub">
                @Html.Action("MenuTwoLevel", "Category", new { action = "Index", controller = "Category" })
            </div>
        </div>
        <div class="bb_cate_right">
            
        </div>
        <div class="clr"></div>
    </div>
    <input type="hidden" id="pvCate" value="@ViewBag.Cate"/>
</div>*@
<div class="layout-width">
    <div class="cate-page-box clearfix">
        <div class="cate-left-box fl">
            <div class="cate-list">
                @*@Html.Action("CategoryMenuLeftAll", "Category")*@
            </div>
        </div>
        <div class="cate-right-box fl">
            <div class="bb_cate_right">
                @Html.Action("ViewProviderHotByCate", "ProviderHome", new { categoryId = ViewBag.Cate })
                @Html.Action("ViewProviderListByCate", "ProviderHome", new { categoryId = ViewBag.Cate })
            </div>
        </div>
        <input type="hidden" id="pvCate" value="@ViewBag.Cate"/>
    </div>
</div>
<!--End PROVIDER-->
@section scripts
{
    <script>

        // Effect for Menu two level
        MenuTwoLevelEffect($('.bb_c_Listsub'));

        /*
            Khi bam vao danh sach chu cai 
            se hien thi cac nha cung cap theo 
            chu dau tien cua chu cai do
        */
        function GetProviderByLetter(cate, letter, cmd) {
            var _cmd = $(cmd);
            $('.listalphabet a').removeClass('selected');
            _cmd.addClass('selected');
            $('#pn-list-provider').html('<img src="/images/icons/gif-load-small.gif" width="30" height="30" alt="babo loading"/>');
            setTimeout(function () {
                $.ajax({
                    url: '/ProviderHome/GetProviderByLetter',
                    data: { categoryId: cate, letter: letter },
                    success: function (data) {
                        if (data) {
                            $('#pn-list-provider').html(data);
                            var count = $('ul.List-provider li').length;
                            $('.totalProvidercate').text(' ' + count + ' ');

                        }
                        else {
                            $('#pn-list-provider').html('');
                            $('.totalProvidercate').text(' 0 ');
                        }
                    },
                    error: function () {
                        alert('Đã có lỗi xảy ra!');
                    }
                });
            }, 200).stop();
        }

        function LoadTotalByCate() {
            var cate = $('#pvCate').val();
            $.ajax({
                url: '/ProviderHome/GetTotalProviderByCate',
                data: { cate: cate },
                success: function (data) {
                    $('.totalProvidercate').text(' ' + data + ' ');
                },
                error: function () {
                    alert('Đã có lỗi xảy ra!');
                }
            });
        }

        LoadTotalByCate();
    </script>
}

